<?php
// Include the default css
drupal_add_css(drupal_get_path('module', 'bookkeep') .'/bk_invoice.css');
?>
<div id="invoicePrintPage">
	
	<h1>Issued <?php print date("j/n/Y"); ?></h1>

	<div id="invoiceFromAddress">
		<span><strong>From</strong></span>
		<div>
			<?php print $YourCompany->title; ?><br/>
			<?php print str_replace("\n","<br/>", $YourCompany->field_address[0]['value']); ?>
		</div>
	</div>
	<div id="invoiceToAddress">
		<span><strong>To</strong></span>
		<div>
			<?php print $CustomerCompany->title; ?><br/>
			<?php print str_replace("\n","<br/>", $CustomerCompany->field_address[0]['value']); ?>
		</div>
	</div>
	<p style="clear: both;">
	<table>
	<tr>
		<th>Description</th>
		<th>Charge</th>
	</tr>

	<?php
	
	$TotalCharge = 0;

	foreach($Items as $node) {
	
		$html = '<tr>';
		
		$TotalCharge+= $node->field_charge[0]['value'];
	
		$html.= '<td>'.$node->title.'</td>';
		$html.= '<td>£'.$node->field_charge[0]['value'].'</td>';
	
		$html.= '</tr>';
	
		print $html;
	}

	?>

	</table>
	
	<div id="invoiceDetails">
		<span><strong>Total Due</strong> £<?php print $TotalCharge; ?></span><br/><br/>
		<span><strong>eMail Address</strong> <?php print $InvoiceSettings['bk_email']; ?></span><br/>
		<span><strong>Bank Name</strong> <?php print $InvoiceSettings['bk_bankname']; ?></span><br/>
		<span><strong>Account Number</strong> <?php print $InvoiceSettings['bk_accountno']; ?></span><br/>
		<span><strong>Sort Code</strong> <?php print $InvoiceSettings['bk_sortcode']; ?></span><br/>
	</div>
</div>